package com.dev.security.manager.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Query;

import com.dev.security.config.dao.BaseRepository;
import com.dev.security.manager.beans.Permission;

/**
 * @author 潜行的青衣
 * @see
 */
public interface PermissionRepository extends BaseRepository<Permission, String> {

	@Query("select p from Permission p where app_id=?1")
	public Page<Permission> findAll(String app_id, Pageable page);
	
	@Query("select p from Permission p where app_id=?1")
	public List<Permission> findAll(String app_id, Sort sort);
	
	@Query("select count(*) from Permission where app_id=?1 and alias=?2")
	public int count(String app_id, String alias);
	
}
